<?php

namespace App\Events;

use App\Http\Controllers\PhpCookBook\Arr\CheckController;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

/**
 * 2.定义事件类
 * Class PostSaved
 * @package App\Events
 */
class PostSaved
{
    use Dispatchable, InteractsWithSockets, SerializesModels;
    //如果使用队列,必须在类前面声明属性,没有使用队列可以忽略,但是最好养成声明的习惯
    public $check;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($check)
    {
        //
        $this->check = $check;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        //return new PrivateChannel('channel-name');
        return [];
    }
}
